package com.zx.erp.sys.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zx.erp.sys.bean.City;
import com.zx.erp.sys.bean.Province;
import com.zx.erp.sys.bean.Users;
import com.zx.erp.sys.mapper.CityMapper;
import com.zx.erp.sys.service.CityService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 作者信息
 * @since 2021-11-10
 */
@Service
public class CityServiceImpl extends ServiceImpl<CityMapper, City> implements CityService {
    @Autowired
    private CityMapper cityMapper;

    @Override
    public Page<Province> cityPage(Province province, Integer pageNo, Integer pageSize) {
        // Step1：创建一个 Page 对象
        Page<Province> page = new Page<>(pageNo, pageSize);
        // Step2：调用 mybatis-plus 提供的分页查询方法
        Page<Province> pageInfo = cityMapper.cityPage(page,province);

        return pageInfo;
    }
    @Override
    public List<City> findAll() {
        return cityMapper.selectAll(new City());
    }

    @Override
    public List<City> findByPid(Integer pid) {
        return cityMapper.selectPic(pid);
    }
}
